//package com.pansoft.hd.multisig;
//
//import static org.web3j.tx.Contract.GAS_LIMIT;
//import static org.web3j.tx.ManagedTransaction.GAS_PRICE;
//
//import java.io.IOException;
//import java.math.BigDecimal;
//import java.math.BigInteger;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.Collections;
//import java.util.List;
//
//import org.web3j.abi.FunctionEncoder;
//import org.web3j.abi.TypeReference;
//import org.web3j.abi.datatypes.Function;
//import org.web3j.abi.datatypes.Type;
//import org.web3j.abi.datatypes.generated.Uint256;
//import org.web3j.crypto.CipherException;
//import org.web3j.crypto.Credentials;
//import org.web3j.crypto.Hash;
//import org.web3j.crypto.RawTransaction;
//import org.web3j.crypto.Sign;
//import org.web3j.crypto.TransactionEncoder;
//import org.web3j.crypto.WalletUtils;
//import org.web3j.protocol.Web3j;
//import org.web3j.protocol.admin.Admin;
//import org.web3j.protocol.core.DefaultBlockParameterName;
//import org.web3j.protocol.core.Request;
//import org.web3j.protocol.core.methods.request.Transaction;
//import org.web3j.protocol.core.methods.response.EthGetTransactionCount;
//import org.web3j.protocol.core.methods.response.EthSendTransaction;
//import org.web3j.protocol.http.HttpService;
//import org.web3j.utils.Convert;
//import org.web3j.utils.Numeric;
//
//import com.osp.blockchain.eth.client.Web3JClient;
//import com.osp.blockchain.eth.transaction.ETHTransaction;
//import com.osp.blockchain.eth.wallet.ETHWallet;
////张明成写的测试类
//public class MultiSignTest {
//
//	public static final String RPCAddress = "http://10.20.31.114:8545/";
//	public Admin turboChainAdmin = Admin.build(new HttpService("http://10.20.31.114:8545/"));
//	public MultiSign_sol_MultiSign multi = MultiSign_sol_MultiSign.load("0xf806e32eadba696bb624dd73344d91d6bd6734e9",
//			Web3JClient.getClient(RPCAddress), MultiSignTest.getCredentials(), GAS_PRICE, GAS_LIMIT);
//
//	public static void main(String[] args) throws Exception {
//		MultiSignTest multiSignTest = new MultiSignTest();
//		multiSignTest.createContract();
//		// multiSignTest.deposit(multiSignTest,
//		// "0x481a4f58ac488cd09e09321378c867999887f2af",
//		// "0xf806e32eadba696bb624dd73344d91d6bd6734e9", "30");
//		multiSignTest.getContractBanlance(multiSignTest);
//		// multiSignTest.getAddressss(multiSignTest);
//
//		/*
//		 * BigInteger nonce = multiSignTest.getNonce(multiSignTest); String hashSha3 =
//		 * multiSignTest.getSha3Hash("0xf806e32eadba696bb624dd73344d91d6bd6734e9",
//		 * "0x9e649427a1fc4b5c7e81e50b869b47fa97741b58", Convert.toWei("2",
//		 * Convert.Unit.ETHER).toBigInteger(), "0x", nonce);
//		 * System.out.println("hashSha3: " + hashSha3);
//		 * multiSignTest.transfer(multiSignTest, hashSha3,
//		 * "0x481a4f58ac488cd09e09321378c867999887f2af", "2",
//		 * "0xf806e32eadba696bb624dd73344d91d6bd6734e9",
//		 * "0x9e649427a1fc4b5c7e81e50b869b47fa97741b58");
//		 */
//
//	}
//
//	/**
//	 * 转账
//	 *
//	 * @param test
//	 * @param hashSha3
//	 * @param ownAddress
//	 * @param mount
//	 * @param contractAddress
//	 * @param destination
//	 * @return
//	 * @throws Exception
//	 */
//	public String transfer(MultiSignTest test, String hashSha3, String ownAddress, String mount, String contractAddress,
//			String destination) throws Exception {
//		Credentials credentials = MultiSignTest.getCredentials();
//		Credentials credentials1 = MultiSignTest.getCredentials2();
//		Credentials credentials2 = MultiSignTest.getCredentials3();
//		byte[] data = Numeric.hexStringToByteArray(hashSha3);
//		Sign.SignatureData signature1 = Sign.signPrefixedMessage(data, credentials1.getEcKeyPair());
//		Sign.SignatureData signature2 = Sign.signPrefixedMessage(data, credentials2.getEcKeyPair());
//		List<BigInteger> sigv = new ArrayList<BigInteger>();
//		List<byte[]> sigr = new ArrayList<byte[]>();
//		List<byte[]> sigs = new ArrayList<byte[]>();
//		sigv.add(Numeric.toBigInt(signature1.getV()));
//		sigv.add(Numeric.toBigInt(signature2.getV()));
//		sigr.add(signature1.getR());
//		sigr.add(signature2.getR());
//		sigs.add(signature1.getS());
//		sigs.add(signature2.getS());
//		BigInteger nonce = test.ethGetTransactionCount(test.turboChainAdmin, ownAddress);
//		BigInteger value = Convert.toWei(mount, Convert.Unit.ETHER).toBigInteger();
//		Function function = new Function("executeTransfer", Arrays.<Type>asList(
//				new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Uint8>(
//						org.web3j.abi.Utils.typeMap(sigv, org.web3j.abi.datatypes.generated.Uint8.class)),
//				new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Bytes32>(
//						org.web3j.abi.Utils.typeMap(sigr, org.web3j.abi.datatypes.generated.Bytes32.class)),
//				new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Bytes32>(
//						org.web3j.abi.Utils.typeMap(sigs, org.web3j.abi.datatypes.generated.Bytes32.class)),
//				new org.web3j.abi.datatypes.Address(destination), new Uint256(value),
//				new org.web3j.abi.datatypes.DynamicBytes(Numeric.hexStringToByteArray("0x"))),
//				Collections.<TypeReference<?>>emptyList());
//		String functionData = FunctionEncoder.encode(function);
//		RawTransaction rawTransaction = RawTransaction.createTransaction(nonce, GAS_PRICE, GAS_LIMIT, contractAddress,
//				functionData);
//		// 签名Transaction，这里要对交易做签名
//		byte[] signedMessage = TransactionEncoder.signMessage(rawTransaction, credentials);
//		String hexValue = Numeric.toHexString(signedMessage);
//		// 发送交易
//		EthSendTransaction ethSendTransaction = test.turboChainAdmin.ethSendRawTransaction(hexValue).send();
//		String transactionHash = ethSendTransaction.getTransactionHash();
//		System.out.println("交易Hash: " + transactionHash);
//		return transactionHash;
//	}
//
//	public void getAddressss(MultiSignTest test) throws Exception {
//		System.out.println(this.multi.ownersArr(new BigInteger("2")).send());
//	}
//
//	public void test2(MultiSignTest test, String hashSha3, String ownAddress, String mount, String contractAddress,
//			String destination) throws Exception {
//		Credentials credentials1 = MultiSignTest.getCredentials2();
//		Credentials credentials2 = MultiSignTest.getCredentials3();
//		byte[] data = Numeric.hexStringToByteArray(hashSha3);
//		Sign.SignatureData signature1 = Sign.signPrefixedMessage(data, credentials1.getEcKeyPair());
//		Sign.SignatureData signature2 = Sign.signPrefixedMessage(data, credentials2.getEcKeyPair());
//		List<BigInteger> sigv = new ArrayList<BigInteger>();
//		List<byte[]> sigr = new ArrayList<byte[]>();
//		List<byte[]> sigs = new ArrayList<byte[]>();
//		sigv.add(Numeric.toBigInt(signature1.getV()));
//		sigv.add(Numeric.toBigInt(signature2.getV()));
//		sigr.add(signature1.getR());
//		sigr.add(signature2.getR());
//		sigs.add(signature1.getS());
//		sigs.add(signature2.getS());
//		BigInteger value = Convert.toWei(mount, Convert.Unit.ETHER).toBigInteger();
//		Function function = new Function("executeTest", Arrays.<Type>asList(
//				new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Uint8>(
//						org.web3j.abi.Utils.typeMap(sigv, org.web3j.abi.datatypes.generated.Uint8.class)),
//				new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Bytes32>(
//						org.web3j.abi.Utils.typeMap(sigr, org.web3j.abi.datatypes.generated.Bytes32.class)),
//				new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.generated.Bytes32>(
//						org.web3j.abi.Utils.typeMap(sigs, org.web3j.abi.datatypes.generated.Bytes32.class)),
//				new org.web3j.abi.datatypes.Address(destination), new Uint256(value),
//				new org.web3j.abi.datatypes.DynamicBytes(Numeric.hexStringToByteArray("0x0"))),
//				Collections.<TypeReference<?>>emptyList());
//		String encodedFunction = FunctionEncoder.encode(function);
//		byte[] datas = test.turboChainAdmin.ethCall(
//				Transaction.createEthCallTransaction("0x481a4f58ac488cd09e09321378c867999887f2af",
//						"0xf806e32eadba696bb624dd73344d91d6bd6734e9", encodedFunction),
//				DefaultBlockParameterName.LATEST).send().getValue().getBytes();
//		String hash = Numeric.toHexString(datas);
//		System.out.println("合约上获取哈希1: " + hash);
//	}
//
//	public BigInteger getNonce(MultiSignTest test) throws Exception {
//		Function function = new Function("nonce", Arrays.<Type>asList(),
//				Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
//				}));
//		String encodedFunction = FunctionEncoder.encode(function);
//		String nonce = test.turboChainAdmin.ethCall(
//				Transaction.createEthCallTransaction("0x01d35112cdfdc9decfbd3dd1acb8188f2b0e7887",
//						"0xf806e32eadba696bb624dd73344d91d6bd6734e9", encodedFunction),
//				DefaultBlockParameterName.LATEST).send().getValue();
//		String nonceNum = MultiSignTest.hexTransformToDec(nonce);
//		System.out.println("多重钱包nonce====" + nonceNum);
//		return new BigInteger(nonceNum);
//	}
//
//	/**
//	 * 获取钱包余额
//	 *
//	 * @param test
//	 * @throws Exception
//	 */
//	public void getContractBanlance(MultiSignTest test) throws Exception {
//		Function function = new Function("balanceOf", Arrays.<Type>asList(),
//				Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
//				}));
//		String encodedFunction = FunctionEncoder.encode(function);
//		String balance = test.turboChainAdmin.ethCall(
//				Transaction.createEthCallTransaction("0x01d35112cdfdc9decfbd3dd1acb8188f2b0e7887",
//						"0xf806e32eadba696bb624dd73344d91d6bd6734e9", encodedFunction),
//				DefaultBlockParameterName.LATEST).send().getValue();
//		System.out.println("多重钱包余额====" + MultiSignTest.hexTransformToDec(balance));
//	}
//
//	/**
//	 * 合约钱包充值
//	 *
//	 * @param test
//	 * @param ownAddress
//	 * @param toAddress
//	 * @param chainId
//	 * @param amountOfMoney
//	 * @return
//	 * @throws IOException
//	 * @throws Exception
//	 */
//	public String deposit(MultiSignTest test, String ownAddress, String toAddress, String amountOfMoney)
//			throws IOException, Exception {
//		Credentials testAddressCredentials = MultiSignTest.getCredentials();
//		BigInteger nonce = test.ethGetTransactionCount(test.turboChainAdmin, ownAddress);
//		BigInteger value = Convert.toWei(amountOfMoney, Convert.Unit.ETHER).toBigInteger();
//		RawTransaction rawTransaction = RawTransaction.createEtherTransaction(nonce, GAS_PRICE, GAS_LIMIT, toAddress,
//				value);
//		// 签名Transaction，这里要对交易做签名
//		byte[] signedMessage = TransactionEncoder.signMessage(rawTransaction, testAddressCredentials);
//		String hexValue = Numeric.toHexString(signedMessage);
//		// 发送交易
//		EthSendTransaction ethSendTransaction = test.turboChainAdmin.ethSendRawTransaction(hexValue).sendAsync().get();
//		String transactionHash = ethSendTransaction.getTransactionHash();
//		System.out.println("自签名转账交易哈希====" + transactionHash);
//		return transactionHash;
//	}
//
//	public BigInteger ethGetTransactionCount(Admin admin, String address) throws IOException, Exception {
//		Request<?, EthGetTransactionCount> request = admin.ethGetTransactionCount(address,
//				DefaultBlockParameterName.LATEST);
//		EthGetTransactionCount ro = request.send();
//		BigInteger transactionCount = ro.getTransactionCount();
//		return transactionCount;
//	}
//
//	public static Credentials getCredentials() {
//		BigInteger p = new BigInteger("28048228501442048189267956591015494076577030861667140253009833017711730989442");
//		String privateKey = p.toString(16);
//		Credentials credentials = Credentials.create(privateKey);
//		return credentials;
//	}
//
//	public static Credentials getCredentials2() {
//		Credentials systemAddressCredentials = null;
//		try {
//			systemAddressCredentials = WalletUtils.loadCredentials("pansoft123456",
//					"D:\\UTC--2018-03-05T03-49-28.887000616Z--4f9b20fe00d0fc7e9ef192dbdd2d6e73430b0212");
//		} catch (IOException e) {
//			e.printStackTrace();
//		} catch (CipherException e) {
//			e.printStackTrace();
//		}
//		return systemAddressCredentials;
//	}
//
//	public static Credentials getCredentials3() {
//		Credentials systemAddressCredentials = null;
//		try {
//			systemAddressCredentials = WalletUtils.loadCredentials("pansoft20181018124",
//					"D:\\UTC--2018-10-18T02-37-06.299025088Z--10c8444e646c36474b38a7a8ee4b6104b620d9e5");
//		} catch (IOException e) {
//			e.printStackTrace();
//		} catch (CipherException e) {
//			e.printStackTrace();
//		}
//		return systemAddressCredentials;
//	}
//
//	/**
//	 * 创建合约
//	 */
//	public void createContract() {
//		List<String> accounts = new ArrayList<String>();
//		accounts.add("0x4f9b20fe00d0fc7e9ef192dbdd2d6e73430b0212");
//		accounts.add("0x481a4f58ac488cd09e09321378c867999887f2af");
//		accounts.add("0x10c8444e646c36474b38a7a8ee4b6104b620d9e5");
//		String encodedConstructor = FunctionEncoder.encodeConstructor(
//				Arrays.<Type>asList(new Uint256(new BigInteger("2")),
//						new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.Address>(
//								org.web3j.abi.Utils.typeMap(accounts, org.web3j.abi.datatypes.Address.class))));
//		String data = "0x60806040523480156200001157600080fd5b506040516200121e3803806200121e83398101806040528101908080519060200190929190805182019291905050506000600a82511115801562000056575081518311155b801562000064575060008314155b15156200007057600080fd5b600090505b8151811015620001c757600073ffffffffffffffffffffffffffffffffffffffff168282815181101515620000a657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff16141580156200013d575060001515600260008484815181101515620000e757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b15156200014957600080fd5b60016002600084848151811015156200015e57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808060010191505062000075565b8160039080519060200190620001df929190620001f0565b5082600181905550505050620002c5565b8280548282559060005260206000209081019282156200026c579160200282015b828111156200026b5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509160200191906001019062000211565b5b5090506200027b91906200027f565b5090565b620002c291905b80821115620002be57600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555060010162000286565b5090565b90565b610f4980620002d56000396000f300608060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806329e33647146100e557806342cde4e81461025c57806369fcba7714610287578063722713f7146103e3578063aa5df9e21461040e578063affed0e01461047b575b7fd241e73300212f6df233a8e6d3146b88a9d4964e06621d54b5ff6afeba7b1b883334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1005b3480156100f157600080fd5b5061023f600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506104a6565b604051808381526020018281526020019250505060405180910390f35b34801561026857600080fd5b50610271610903565b6040518082815260200191505060405180910390f35b34801561029357600080fd5b506103e1600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610909565b005b3480156103ef57600080fd5b506103f8610eba565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b5061043960048036038101908080359060200190929190505050610ed9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048757600080fd5b50610490610f17565b6040518082815260200191505060405180910390f35b6000806000606060008060006001548c511415156104c357600080fd5b8a518c511480156104d557508c518c51145b15156104e057600080fd5b60197f01000000000000000000000000000000000000000000000000000000000000000260007f010000000000000000000000000000000000000000000000000000000000000002308c8c8c60005460405180887effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152600101877effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526001018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140184815260200183805190602001908083835b602083101515610680578051825260208201915060208101905060208303925061065b565b6001836020036101000a038019825116818451168082178552505050505050905001828152602001975050505050505050604051809103902094506040805190810160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152509350600092505b6001548310156108e45783856040518083805190602001908083835b6020831015156107395780518252602082019150602081019050602083039250610714565b6001836020036101000a038019825116818451168082178552505050505050905001826000191660001916815260200192505050604051809103902091506001828e8581518110151561078857fe5b906020019060200201518e868151811015156107a057fe5b906020019060200201518e878151811015156107b857fe5b90602001906020020151604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015610833573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141580156108cc575060011515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b15156108d757600080fd5b82806001019350506106f8565b6001600054019650600180540195505050505050965096945050505050565b60015481565b60006060600080600060011515600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561097157600080fd5b6001548a5114151561098257600080fd5b88518a5114801561099457508a518a51145b151561099f57600080fd5b60197f01000000000000000000000000000000000000000000000000000000000000000260007f010000000000000000000000000000000000000000000000000000000000000002308a8a8a60005460405180887effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152600101877effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526001018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140184815260200183805190602001908083835b602083101515610b3f5780518252602082019150602081019050602083039250610b1a565b6001836020036101000a038019825116818451168082178552505050505050905001828152602001975050505050505050604051809103902094506040805190810160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152509350600092505b600154831015610da35783856040518083805190602001908083835b602083101515610bf85780518252602082019150602081019050602083039250610bd3565b6001836020036101000a038019825116818451168082178552505050505050905001826000191660001916815260200192505050604051809103902091506001828c85815181101515610c4757fe5b906020019060200201518c86815181101515610c5f57fe5b906020019060200201518c87815181101515610c7757fe5b90602001906020020151604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015610cf2573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015610d8b575060011515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b1515610d9657600080fd5b8280600101935050610bb7565b8773ffffffffffffffffffffffffffffffffffffffff16878760405180828051906020019080838360005b83811015610de9578082015181840152602081019050610dce565b50505050905090810190601f168015610e165780820380516001836020036101000a031916815260200191505b5091505060006040518083038185875af1925050501515610e3657600080fd5b6001600054016000819055507fc95f8b91b103304386b955ef73fadac189f8ad66b33369b6c34a17a60db7bd0a8888604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050505050505050505050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b600381815481101515610ee857fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600054815600a165627a7a723058209f380c65c1f4527bb6ce9dd3defb142e7df84c406bd32ed0545b3a09e623260f0029";
//		data += encodedConstructor;
//		System.out.println("data=======" + data);
//		Credentials credentials = ETHWallet.getCredentials(
//				new BigInteger("28048228501442048189267956591015494076577030861667140253009833017711730989442"));
//		BigInteger nonce = ETHTransaction.ethGetTransactionCount(Web3JClient.getClient(RPCAddress), accountAddress);
//		BigInteger value = Convert.toWei("0", Convert.Unit.ETHER).toBigInteger();
//		String txnHashString = ETHTransaction.createContractTransaction(Web3JClient.getClient(RPCAddress), credentials,
//				nonce, GAS_PRICE, GAS_LIMIT, value, data);
//		System.out.println("交易Hash====" + txnHashString);
//	}
//
//	/**
//	 * 大整数16进制转10进制
//	 *
//	 * @param value
//	 * @return
//	 */
//	public static String hexTransformToDec(String value) {
//		if (value == null || value.isEmpty() == true || (value.startsWith("0x") == true && value.length() == 2)) {
//			return "0";
//		}
//		if (value.startsWith("0x") == true && value.length() >= 2) {
//			value = value.substring(2, value.length());
//		}
//		BigInteger valueB = new BigInteger(value, 16);
//		BigDecimal result = new BigDecimal(valueB.toString());
//		return result.toPlainString();
//	}
//
//	/**
//	 * Hash.sha3(待签名数据)
//	 *
//	 * @param contractAddress
//	 * @param destinationAddress
//	 * @param value
//	 * @param data
//	 * @param nonce
//	 * @return
//	 * @throws Exception
//	 */
//	public String getSha3Hash(String contractAddress, String destinationAddress, BigInteger value, String data,
//			BigInteger nonce) throws Exception {
//		String message = "0x1900" + contractAddress.substring(2) + destinationAddress.substring(2)
//				+ Numeric.toHexStringNoPrefixZeroPadded(value, 64) + data.substring(2)
//				+ Numeric.toHexStringNoPrefixZeroPadded(nonce, 64);
//		return Hash.sha3(message);
//	}
//
//	/**
//	 *
//	 * @param accounts  共同拥有人地址列表
//	 * @param m         满足m人签名即可进行交易
//	 * @param credentials   发起创建钱包用户证书
//	 * @param nonce     发起创建钱包用户nonce值
//	 * @return hexValue 创建钱包的签名
//	 */
//	public String createETHMultiSignWallet(List<String> accounts, BigInteger m, Credentials credentials, BigInteger nonce) {
//		String encodedConstructor = FunctionEncoder
//				.encodeConstructor(Arrays.<Type>asList(new Uint256(m),
//						new org.web3j.abi.datatypes.DynamicArray<org.web3j.abi.datatypes.Address>(
//								org.web3j.abi.Utils.typeMap(accounts, org.web3j.abi.datatypes.Address.class))));
//		//这是智能合约代码编译生成的，不能改动
//		String data = "0x60806040523480156200001157600080fd5b506040516200121e3803806200121e83398101806040528101908080519060200190929190805182019291905050506000600a82511115801562000056575081518311155b801562000064575060008314155b15156200007057600080fd5b600090505b8151811015620001c757600073ffffffffffffffffffffffffffffffffffffffff168282815181101515620000a657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff16141580156200013d575060001515600260008484815181101515620000e757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b15156200014957600080fd5b60016002600084848151811015156200015e57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808060010191505062000075565b8160039080519060200190620001df929190620001f0565b5082600181905550505050620002c5565b8280548282559060005260206000209081019282156200026c579160200282015b828111156200026b5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509160200191906001019062000211565b5b5090506200027b91906200027f565b5090565b620002c291905b80821115620002be57600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555060010162000286565b5090565b90565b610f4980620002d56000396000f300608060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806329e33647146100e557806342cde4e81461025c57806369fcba7714610287578063722713f7146103e3578063aa5df9e21461040e578063affed0e01461047b575b7fd241e73300212f6df233a8e6d3146b88a9d4964e06621d54b5ff6afeba7b1b883334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1005b3480156100f157600080fd5b5061023f600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506104a6565b604051808381526020018281526020019250505060405180910390f35b34801561026857600080fd5b50610271610903565b6040518082815260200191505060405180910390f35b34801561029357600080fd5b506103e1600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610909565b005b3480156103ef57600080fd5b506103f8610eba565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b5061043960048036038101908080359060200190929190505050610ed9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048757600080fd5b50610490610f17565b6040518082815260200191505060405180910390f35b6000806000606060008060006001548c511415156104c357600080fd5b8a518c511480156104d557508c518c51145b15156104e057600080fd5b60197f01000000000000000000000000000000000000000000000000000000000000000260007f010000000000000000000000000000000000000000000000000000000000000002308c8c8c60005460405180887effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152600101877effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526001018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140184815260200183805190602001908083835b602083101515610680578051825260208201915060208101905060208303925061065b565b6001836020036101000a038019825116818451168082178552505050505050905001828152602001975050505050505050604051809103902094506040805190810160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152509350600092505b6001548310156108e45783856040518083805190602001908083835b6020831015156107395780518252602082019150602081019050602083039250610714565b6001836020036101000a038019825116818451168082178552505050505050905001826000191660001916815260200192505050604051809103902091506001828e8581518110151561078857fe5b906020019060200201518e868151811015156107a057fe5b906020019060200201518e878151811015156107b857fe5b90602001906020020151604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015610833573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141580156108cc575060011515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b15156108d757600080fd5b82806001019350506106f8565b6001600054019650600180540195505050505050965096945050505050565b60015481565b60006060600080600060011515600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561097157600080fd5b6001548a5114151561098257600080fd5b88518a5114801561099457508a518a51145b151561099f57600080fd5b60197f01000000000000000000000000000000000000000000000000000000000000000260007f010000000000000000000000000000000000000000000000000000000000000002308a8a8a60005460405180887effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152600101877effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526001018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140184815260200183805190602001908083835b602083101515610b3f5780518252602082019150602081019050602083039250610b1a565b6001836020036101000a038019825116818451168082178552505050505050905001828152602001975050505050505050604051809103902094506040805190810160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152509350600092505b600154831015610da35783856040518083805190602001908083835b602083101515610bf85780518252602082019150602081019050602083039250610bd3565b6001836020036101000a038019825116818451168082178552505050505050905001826000191660001916815260200192505050604051809103902091506001828c85815181101515610c4757fe5b906020019060200201518c86815181101515610c5f57fe5b906020019060200201518c87815181101515610c7757fe5b90602001906020020151604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015610cf2573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015610d8b575060011515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b1515610d9657600080fd5b8280600101935050610bb7565b8773ffffffffffffffffffffffffffffffffffffffff16878760405180828051906020019080838360005b83811015610de9578082015181840152602081019050610dce565b50505050905090810190601f168015610e165780820380516001836020036101000a031916815260200191505b5091505060006040518083038185875af1925050501515610e3657600080fd5b6001600054016000819055507fc95f8b91b103304386b955ef73fadac189f8ad66b33369b6c34a17a60db7bd0a8888604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050505050505050505050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b600381815481101515610ee857fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600054815600a165627a7a723058209f380c65c1f4527bb6ce9dd3defb142e7df84c406bd32ed0545b3a09e623260f0029";
//		//合约拼接数据
//		data += encodedConstructor;
//		BigInteger value = Convert.toWei("0", Convert.Unit.ETHER).toBigInteger();
//		//创建交易
//		RawTransaction rawTransaction = RawTransaction.createContractTransaction(nonce,  GAS_PRICE, GAS_LIMIT, value,
//				data);
//		// 签名Transaction
//		byte[] signedMessage = TransactionEncoder.signMessage(rawTransaction, credentials);
//		//签名16进制数据
//		String hexValue = Numeric.toHexString(signedMessage);
//
////		String txnHash = ETHTransaction.createContractTransaction(web3jClient, credentials, nonce, GAS_PRICE, GAS_LIMIT,
////				value, data);
//		return hexValue;
//	}
//}